package com.sl.ms.carriage.handler;

import com.sl.ms.carriage.domain.dto.WaybillDTO;
import com.sl.ms.carriage.entity.CarriageEntity;

/**
 * description:
 *
 * @Author youhongwei
 * @Create 2025/6/23 20:01
 * @Version 1.0
 */
public abstract class AbsCarriageChainHandler {

  private AbsCarriageChainHandler nextHandler;

    /**
     * 执行的入口方法
     * @param waybillDTO
     * @return
     */
  public abstract CarriageEntity doHandler(WaybillDTO waybillDTO);

    /**
     * 返回策略 + 是否要执行取下个策略
     * @param waybillDTO
     * @return
     */
  protected CarriageEntity doNextHandler(WaybillDTO waybillDTO){

      return this.nextHandler.doHandler(waybillDTO);
  }

    /**
     * 处理下一个对象
     * @param nextHandler
     */
  public void setNextHandler(AbsCarriageChainHandler nextHandler){
      this.nextHandler = nextHandler;
  }


}
